<template>
  <el-form-item label="绑定实体">
    <el-select-tree
      :value.sync="optionModel.entity"
      :options="designer.entityList"
    ></el-select-tree>
  </el-form-item>
</template>

<script>
import i18n from "@/utils/i18n";
import ElSelectTree from "@/components/el-select-tree.vue";
import * as api from "@/api/modulManage/entity";

export default {
  name: "entity-editor",
  componentName: "PropertyEditor",
  components: { ElSelectTree },
  mixins: [i18n],
  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object,
  },
  data() {
    return {
    };
  },
  created() {
    if (this.optionModel.entity && !this.designer.loadingData) {
       this.designer.loadingData = true;
      api
        .getTypeAllAttributeByName({ typeName: this.optionModel.entity })
        .then((res) => {
           this.designer.loadingData = false;
          if (!res.data || !res.data.data) {
            return;
          }
          this.designer.attrList = [...res.data.data];
        });
    }
  },
};
</script>

<style scoped>
</style>
